package com.example.flinktest.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class SourceCustom {
    public static void main(String[] args) {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        //有了自定义的source function,调用addSource方法
        DataStreamSource<Event> stream = env.addSource(new ClickSource());
        //设置stream并发度为2，会报错，env可以设置并发度为2
//        stream.setParallelism(2);
        stream.print("SourceCustom");

        try {
            env.execute();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
